]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Disable modem connection when windows aren't allowed
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 7 Jun 2021 15:49:57 +0000 (17:49 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 16 Jul 2021 22:21:12 +0000 (22:21 +0000)
The item launches the corresponding Settings panel when activated, which
doesn't work when windows are disabled by the session mode. Rather than
failing silently, turn the item insensitive.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1874>

js/ui/status/network.js

index 5487fde40fe403d875591f91472621d24f0162c5..6e7878d20cc08c5fea90200b07338490c1271553 100644 (file)
@@ -563,6 +563,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
                 this._iconChanged();
             });
         }
+
+        this._sessionUpdatedId =
+            Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
+        this._sessionUpdated();
     }
 
     get category() {
@@ -573,6 +577,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
         launchSettingsPanel('network', 'connect-3g', this._device.get_path());
     }
 
+    _sessionUpdated() {
+        this._autoConnectItem.sensitive = Main.sessionMode.hasWindows;
+    }
+
     destroy() {
         if (this._operatorNameId) {
             this._mobileDevice.disconnect(this._operatorNameId);
@@ -582,6 +590,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
             this._mobileDevice.disconnect(this._signalQualityId);
             this._signalQualityId = 0;
         }
+        if (this._sessionUpdatedId) {
+            Main.sessionMode.disconnect(this._sessionUpdatedId);
+            this._sessionUpdatedId = 0;
+        }
 
         super.destroy();
     }